import basic from './basic.js';
var actmodel = new basic();

actmodel.getitems = function (phone) {

  var app = getApp();
  return new Promise((resolve, reject) => {
    app.util.request({
      'url': 'entry/wxapp/recharge_htorder',
      showLoading: true,      
      'data': { "op": "getitems",plugin:'smapi',phone},
      'method': "post",
      success: function (res) {
        resolve(res.data.data);  
      },
      fail: function (res) {
        resolve({ status: -1, "message": "操作失败" });
      },
      complete: function () {
      }
    },true);
  })
}

actmodel.createorder = function (data) {

  var app = getApp();
  return new Promise((resolve, reject) => {
    app.util.request({
      'url': 'entry/wxapp/recharge_htorder',
      showLoading: true,      
      'data': { "op": "createorder",plugin:'smapi',data:JSON.stringify(data)},
      'method': "post",
      success: function (res) {
        resolve(res.data.data);  
      },
      fail: function (res) {
        resolve({ status: -1, "message": "操作失败" });
      },
      complete: function () {
      }
    },true);
  })
}
actmodel.queryorder=function (id) {

  var app = getApp();
  var data = { "op": "queryorder", id: id,plugin:'smapi'}
  return new Promise((resolve, reject) => {
    app.util.request({
      'url': 'entry/wxapp/recharge_order',
      'data': data,
      'method': "post",
      success: function (res) {
        
        resolve(res.data.data);
      }
    })
})
}

actmodel.sendnotice_buy=function (ordernum) {

  var app = getApp();
  var data = { "op": "sendnotice_buy", ordernum: ordernum,plugin:'smapi'}
  return new Promise((resolve, reject) => {
    app.util.request({
      'url': 'entry/wxapp/recharge_order',
      'data': data,
      'method': "post",
      success: function (res) {
        
        resolve(res.data.data);
      }
    })
})
}
module.exports = actmodel;
